From: umherirrender Date: Sat, 29 Oct 2016 18:50:57 +0000 (+0200) Subject: Use Database::addQuotes in Special:WantedPages/UnwatchedPages X-Git-Tag: 1.31.0-rc.0~4970^2 X-Git-Url: http://git.cyclocoop.org/%27%20.%20%24prefix%20.%20Wiki::transformTitleToURI%28%24matches%5B1%5D%29%20.%20%27?a=commitdiff_plain;h=6dba668f4dcccd395289b219ec1f4378d76a134a;p=lhc%2Fweb%2Fwiklou.git Use Database::addQuotes in Special:WantedPages/UnwatchedPages Database::addQuotes uses the correct quotes/apos, hopefully together with numeric values Change-Id: Ia3aba8cabf3ae877f56185e5724dca204a19f73a --- diff --git a/includes/specials/SpecialUnwatchedpages.php b/includes/specials/SpecialUnwatchedpages.php index df57744b3a..a4e96ae025 100644 --- a/includes/specials/SpecialUnwatchedpages.php +++ b/includes/specials/SpecialUnwatchedpages.php @@ -44,6 +44,7 @@ class UnwatchedpagesPage extends QueryPage { } public function getQueryInfo() { + $dbr = wfGetDB( DB_REPLICA ); return [ 'tables' => [ 'page', 'watchlist' ], 'fields' => [ @@ -54,7 +55,7 @@ class UnwatchedpagesPage extends QueryPage { 'conds' => [ 'wl_title IS NULL', 'page_is_redirect' => 0, - "page_namespace != '" . NS_MEDIAWIKI . "'" + 'page_namespace != ' . $dbr->addQuotes( NS_MEDIAWIKI ), ], 'join_conds' => [ 'watchlist' => [ 'LEFT JOIN', [ 'wl_title = page_title', diff --git a/includes/specials/SpecialWantedpages.php b/includes/specials/SpecialWantedpages.php index 76b721c542..c37ecbd17a 100644 --- a/includes/specials/SpecialWantedpages.php +++ b/includes/specials/SpecialWantedpages.php @@ -49,6 +49,7 @@ class WantedPagesPage extends WantedQueryPage { } function getQueryInfo() { + $dbr = wfGetDB( DB_REPLICA ); $count = $this->getConfig()->get( 'WantedPagesThreshold' ) - 1; $query = [ 'tables' => [ @@ -63,13 +64,13 @@ class WantedPagesPage extends WantedQueryPage { ], 'conds' => [ 'pg1.page_namespace IS NULL', - "pl_namespace NOT IN ( '" . NS_USER . "', '" . NS_USER_TALK . "' )", - "pg2.page_namespace != '" . NS_MEDIAWIKI . "'" + 'pl_namespace NOT IN (' . $dbr->makeList( [ NS_USER, NS_USER_TALK ] ) . ')', + 'pg2.page_namespace != ' . $dbr->addQuotes( NS_MEDIAWIKI ), ], 'options' => [ 'HAVING' => [ - "COUNT(*) > $count", - "COUNT(*) > SUM(pg2.page_is_redirect)" + 'COUNT(*) > ' . $dbr->addQuotes( $count ), + 'COUNT(*) > SUM(pg2.page_is_redirect)' ], 'GROUP BY' => [ 'pl_namespace', 'pl_title' ] ],